package net.sourceforge.peertwitter.mbpast;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import rice.p2p.commonapi.Id;
import rice.p2p.commonapi.Message;
import rice.p2p.commonapi.NodeHandle;

public class ReplicaMessage implements Serializable, Message {

	private static final long serialVersionUID = -504121026185262921L;
	private final Set<Id> replicas;
	private final NodeHandle sender;
	private final Date timestamp; 
	
	public NodeHandle getSender() {
		return sender;
	}


	public Date getTimestamp() {
		return timestamp;
	}


	public ReplicaMessage (NodeHandle sender, Set<Id>replicas, Date timestamp) {
		this.replicas = replicas;
		this.sender = sender;
		this.timestamp = timestamp;
	}
	
	@Override
	public String toString() {
		return "ReplicaMessage [sender=" + sender + ", timestamp=" + timestamp
				+ ", size="+ replicas.size() + "]";
	}


	public Set<Id>getReplicas() {
		return this.replicas;
	}
	
	@Override
	public int getPriority() {
		return Message.HIGH_PRIORITY;
	}


}
